package com.torches.cloud.entities;

import java.util.HashMap;

/**
 * @author torches
 */
public class Msg {
    private Integer code;
    private String msg;
    private HashMap<String, Object> data;

    public Msg() {

    }

    public static Msg getMsg(Integer code, String msg){
        Msg Msg = new Msg(code, msg, new HashMap<>());
        return Msg;
    }

    public Msg addData(String key, Object obj){
        this.data.put(key, obj);
        return this;
    }

    public Msg(Integer code, String msg, HashMap<String, Object> data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public HashMap<String, Object> getData() {
        return data;
    }

    public void setData(HashMap<String, Object> data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "Msg{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
